//
//  NSData-Hex.m
//  CmnLib
//
//  Created by 21CN Vgo on 11-10-9.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "NSData-Hex.h"


@implementation NSData (Hex)

- (NSString *)toHexString
{
	const uint8_t * data = [self bytes];
    NSMutableString *string = [NSMutableString stringWithCapacity:[self length] * 2];
    for (int i = 0; i < [self length]; i++)
        [string appendFormat:@"%02x", data[i]];
    return string;
}

@end
